﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ObTookit.Model
{
    public class CodeFileObject
    {
        string fileName;
        /// <summary>
        /// 
        /// </summary>
        public string FileName
        {
            get { return fileName; }
            set { fileName = value; }
        }
        string fileExt;
        /// <summary>
        /// 
        /// </summary>
        public string FileExt
        {
            get { return fileExt; }
            set { fileExt = value; }
        }

        string filePath;
        /// <summary>
        /// 
        /// </summary>
        public string FilePath
        {
            get { return filePath; }
            set { filePath = value; }
        }

        string content;
        /// <summary>
        /// 
        /// </summary>
        public string Content
        {
            get { return content; }
            set { content = value; }
        }


        public void WriteFile()
        {
            string Path = this.FilePath;
            string Strings = this.Content;
            if (!System.IO.File.Exists(Path))
            {
                System.IO.FileStream f = System.IO.File.Create(Path);
                f.Close();
            }
            System.IO.StreamWriter f2 = new System.IO.StreamWriter(Path, false, System.Text.Encoding.GetEncoding("gb2312"));
            f2.Write(Strings);
            f2.Close();
            f2.Dispose();
        }
    }
}
